package com.example.service.service;

import android.app.Notification;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;

import androidx.core.app.NotificationCompat;

import com.example.service.R;

public class MyBindService extends Service {

    private final String TAG = "MyBindService" ;
    public MyBindService() {
    }

    @Override
    public IBinder onBind(Intent intent) {
        // TODO: Return the communication channel to the service.
//        throw new UnsupportedOperationException("Not yet implemented");
        Log.d(TAG,"onBind");
        return new MyBinder();
    }

    @Override
    public void onCreate() {
        Log.d(TAG,"onCreate");

        super.onCreate();
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.d(TAG,"onStartCommand");
        return super.onStartCommand(intent, flags, startId);
    }

    @Override
    public void onDestroy() {
        Log.d(TAG,"onDestroy");
        super.onDestroy();
    }

    public class MyBinder extends Binder {
        public  void test(){
            System.out.println("test:myBindService被调用了test方法");
        }
    }
}